package com.nginxmanager.server.config.nginxConf;

import com.nginxmanager.comment.FileTool;
import com.nginxmanager.comment.ModelFileTool;
import com.nginxmanager.domain.Conf;
import com.nginxmanager.domain.Model;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2018-01-11.
 */
public class ModelFileConf {
    ModelFileTool modelFileConf = new ModelFileTool();
    FileTool fileTool = new FileTool();
    public List<String> get(String url, Conf conf){
        List<String> serverList = new ArrayList<>();
        if (conf.getKey().isEmpty()){
            serverList.add("传入的配置为空");
            return serverList;
        }
        serverList = fileTool.findOne(url,conf);
        return null;
    }

    public List<String> add(String url,Model conf){
        List<String> serverList = new ArrayList<>();
        if (conf.getKey().isEmpty()){
            serverList.add("传入的配置为空");
            return serverList;
        }
         modelFileConf.addOne(url,conf);
        serverList.add("完成");
        return serverList;
    }

    public List<String> delete(String url,Model conf){
        List<String> serverList = new ArrayList<>();
        if (conf.getKey().isEmpty()){
            serverList.add("传入的配置为空");
            return serverList;
        }
        modelFileConf.deleteOne(url,conf);
        serverList.add("完成");
        return serverList;
    }
}
